{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>instant</th>\n",
       "      <th>season_1</th>\n",
       "      <th>season_2</th>\n",
       "      <th>season_3</th>\n",
       "      <th>season_4</th>\n",
       "      <th>mnth_1</th>\n",
       "      <th>mnth_2</th>\n",
       "      <th>mnth_3</th>\n",
       "      <th>mnth_4</th>\n",
       "      <th>mnth_5</th>\n",
       "      <th>...</th>\n",
       "      <th>weekday_5</th>\n",
       "      <th>weekday_6</th>\n",
       "      <th>temp</th>\n",
       "      <th>atemp</th>\n",
       "      <th>hum</th>\n",
       "      <th>windspeed</th>\n",
       "      <th>holiday</th>\n",
       "      <th>workingday</th>\n",
       "      <th>yr</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.826662</td>\n",
       "      <td>-0.679946</td>\n",
       "      <td>1.250171</td>\n",
       "      <td>-0.387892</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>985</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>-0.721095</td>\n",
       "      <td>-0.740652</td>\n",
       "      <td>0.479113</td>\n",
       "      <td>0.749602</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>801</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>-1.634657</td>\n",
       "      <td>-1.749767</td>\n",
       "      <td>-1.339274</td>\n",
       "      <td>0.746632</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>-1.614780</td>\n",
       "      <td>-1.610270</td>\n",
       "      <td>-0.263182</td>\n",
       "      <td>-0.389829</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1562</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>-1.467414</td>\n",
       "      <td>-1.504971</td>\n",
       "      <td>-1.341494</td>\n",
       "      <td>-0.046307</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1600</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   instant  season_1  season_2  season_3  season_4  mnth_1  mnth_2  mnth_3  \\\n",
       "0        1         1         0         0         0       1       0       0   \n",
       "1        2         1         0         0         0       1       0       0   \n",
       "2        3         1         0         0         0       1       0       0   \n",
       "3        4         1         0         0         0       1       0       0   \n",
       "4        5         1         0         0         0       1       0       0   \n",
       "\n",
       "   mnth_4  mnth_5  ...   weekday_5  weekday_6      temp     atemp       hum  \\\n",
       "0       0       0  ...           0          1 -0.826662 -0.679946  1.250171   \n",
       "1       0       0  ...           0          0 -0.721095 -0.740652  0.479113   \n",
       "2       0       0  ...           0          0 -1.634657 -1.749767 -1.339274   \n",
       "3       0       0  ...           0          0 -1.614780 -1.610270 -0.263182   \n",
       "4       0       0  ...           0          0 -1.467414 -1.504971 -1.341494   \n",
       "\n",
       "   windspeed  holiday  workingday  yr   cnt  \n",
       "0  -0.387892        0           0   0   985  \n",
       "1   0.749602        0           0   0   801  \n",
       "2   0.746632        0           1   0  1349  \n",
       "3  -0.389829        0           1   0  1562  \n",
       "4  -0.046307        0           1   0  1600  \n",
       "\n",
       "[5 rows x 35 columns]"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = pd.read_csv('data.csv')\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(584, 34)"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 从原始数据中分离输入特征x和输出y\n",
    "y = data['cnt'].values\n",
    "X = data.drop('cnt', axis = 1)\n",
    "\n",
    "#用于后续显示权重系数对应的特征\n",
    "columns = X.columns\n",
    "\n",
    "#将数据分割训练数据与测试数据\n",
    "from sklearn.model_selection import train_test_split\n",
    "\n",
    "# 随机采样20%的数据构建测试样本，其余作为训练样本\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=33, test_size=0.2)\n",
    "X_train.shape\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RMSE on Training set : 742.7543512758714\n",
      "RMSE on Test set : 814.4749076863662\n",
      "r2_score on Training set : 0.8516480637403496\n",
      "r2_score on Test set : 0.8279474225980321\n"
     ]
    }
   ],
   "source": [
    "from sklearn.linear_model import LinearRegression\n",
    "\n",
    "lr = LinearRegression()\n",
    "\n",
    "lr.fit(X_train, y_train)\n",
    "\n",
    "y_train_pred = lr.predict(X_train)\n",
    "y_test_pred = lr.predict(X_test)\n",
    "\n",
    "from sklearn.metrics import mean_squared_error\n",
    "\n",
    "rmse_train = np.sqrt(mean_squared_error(y_train,y_train_pred))\n",
    "rmse_test = np.sqrt(mean_squared_error(y_test,y_test_pred))\n",
    "print(\"RMSE on Training set :\", rmse_train)\n",
    "print(\"RMSE on Test set :\", rmse_test)\n",
    "\n",
    "from sklearn.metrics import r2_score\n",
    "\n",
    "r2_score_train = r2_score(y_train,y_train_pred)\n",
    "r2_score_test = r2_score(y_test,y_test_pred)\n",
    "print(\"r2_score on Training set :\", r2_score_train)\n",
    "print(\"r2_score on Test set :\", r2_score_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAacAAAD8CAYAAADT0WsYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3XuYVdV9//H3JwavGDFKDAYRBS1RUdDxVkOKSjVVq7Hiz9svAXKh5lJ/aeqFqlXy2Dw1JYkxJmoVjTeSGImmJpgghSCEIAhyGaw3FFKJVsFEo4kSle/vj7VGDsM5M2fOzJzLzOf1PDzus8/ae681Di7X2mt/tiICMzOzevKeWlfAzMysNXdOZmZWd9w5mZlZ3XHnZGZmdcedk5mZ1R13TmZmVnfcOZmZWd1x52RmZnXHnZOZmdWd99a6Ao1q9913j8GDB9e6GmZmDWXp0qUbIqJ/e+XcOVVo8ODBLFmypNbVMDNrKJJ+U045T+uZmVnd8cipBEnbRMQ7ta6Hwew5Q2pdBTMrcPxxz3T7NXpt5yTpKmBDRFybP38VeBE4HXgBGAEcULsampn1Xr15Wu8WYByApPcAZwO/BY4ALosId0xmZjXSa0dOEbFW0suSRgJ7AMuAl4HFEbGm2DGSJgITAQYNGlS1upqZ9Ta9eeQEMBUYD0wAbs37/liqcETcFBFNEdHUv3+7KyHNzKxCvb1zug/4GHA4MLPGdTEzs6zXTusBRMSfJf0SeCUi3pFU6ypZEdVYGWRm9aVXd055IcRRwJkAETEXmFvDKpmZGb14Wk/SAcBqYHZEPF3r+piZ2Wa9duQUEf8N7FvrepiZ2dZ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LSPPuTwN8U7D+JtArrGdLUYMv+fUm/sKuBe4Dtat2+tupbT3+AHwAvAG/lfx+fJs31zwaezv98fy4r4Lu5Pc1sucryU/nnvxqYUIN2fIQ03bOS9Nbo5fnn31BtAQ4GluV2rAKuyPuL/o6TRiX35P2LgX0LzlX071EN/t2MZvNqvYZtR0f/OCHCzMzqjqf1zMys7rhzMjOzuuPOyczM6o47JzMzqzvunMzMrO64czIzs7rjzsnMzOqOOyczM6s7/x+3JAG9uP471QAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#最小二乘线性回归模型的coef_\n",
    "coefs = pd.Series(lr.coef_, index = X_train.columns)\n",
    "\n",
    "lr_coefs = pd.concat([coefs.sort_values().head(10), coefs.sort_values().tail(10)])\n",
    "lr_coefs.plot(kind = \"barh\")\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Best alpha : 1.0\n",
      "RMSE on Training set : 746.6117967899507\n",
      "RMSE on Test set : 808.7484352327419\n",
      "r2_score on Training set : 0.850103150523826\n",
      "r2_score on Test set : 0.8303582783162683\n"
     ]
    }
   ],
   "source": [
    "from sklearn.linear_model import RidgeCV\n",
    "\n",
    "alphas = [0.01, 0.1, 1, 10 , 100]\n",
    "ridge = RidgeCV(alphas = alphas, store_cv_values =True)\n",
    "ridge.fit(X_train, y_train)\n",
    "\n",
    "alpha = ridge.alpha_\n",
    "print(\"Best alpha :\", alpha)\n",
    "\n",
    "y_train_pred = ridge.predict(X_train)\n",
    "rmse_train = np.sqrt(mean_squared_error(y_train,y_train_pred))\n",
    "\n",
    "y_test_pred = ridge.predict(X_test)\n",
    "rmse_test = np.sqrt(mean_squared_error(y_test,y_test_pred))\n",
    "\n",
    "print(\"RMSE on Training set :\", rmse_train)\n",
    "print(\"RMSE on Test set :\", rmse_test)\n",
    "\n",
    "r2_score_train = r2_score(y_train,y_train_pred)\n",
    "r2_score_test  = r2_score(y_test,y_test_pred)\n",
    "print(\"r2_score on Training set :\", r2_score_train)\n",
    "print(\"r2_score on Test set :\", r2_score_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAacAAAD8CAYAAADT0WsYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3Xu8XfOd//HXm7pHKVKTDpEKJi4hiNsok0RKB6364ec2bRKd+lHqN2Nc0jKajvpVR1tt1aWoe0ZdSqvVipRGgiQkJDlJEZekIxgSLcOUVOXz++P7PbKzs885e5/ss9fe57yfj8d5ZO3v/q61vt/IeXyttb7r/VVEYGZm1kzWKroBZmZm5Tw4mZlZ0/HgZGZmTceDk5mZNR0PTmZm1nQ8OJmZWdPx4GRmZk3Hg5OZmTUdD05mZtZ0PlR0A1rVFltsEYMGDSq6GWZmLWX27NnLIqJ/V/U8OHXToEGDmDVrVtHNMDNrKZJ+X00939YzM7Om4yunDkhaOyLeL7od1rc98ODgoptgtpqDRj3f4+fos4OTpAuBZRHx/fz5IuBV4EjgFWAYsFNxLTQz67v68m29HwNjACStBRwHvATsDZwXER6YzMwK0mevnCJisaTXJe0ObAk8CbwOPBYRiyrtI+lk4GSAgQMHNqytZmZ9TV++cgK4FhgLjAOuy2X/01HliLg6IoZHxPD+/bucCWlmZt3U1wenu4FPAXsBkwpui5mZZX32th5ARPxZ0m+BNyLifUlFN8lsFY2YFWXWjPr04JQnQuwLHAMQEVOAKQU2yczM6MO39STtBDwHPBARzxbdHjMzW6nPX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yAdneo7BnEkUD7zKKa+trINndTq7b7A5I2UlqkFKVVrA8m/fe6h/RvC1b9N3YP8Pk8y21f4M3222VNrtb+TAIOlvSRfJvs4FzWdAr9fSt6hoh/6jLL5kjS/8ksB14lLVvf/t15pNkzzwB/X1J+KLAwf3deSfm2+R/Zc8AdwHpF96+srzeTlmKZl//RD+huX5v9p1XbXfZvaW7+WdDeB9KzzQeAZ/Ofm+VyAZfn/rZRMvO0WX6AW0m3t97Lv3Nf6E5/gJPy79hzwLii+9VJ3wr7fXNChJmZNR3f1jMzs6bjwcnMzJqOByczM2s6HpzMzKzpeHAyM7Om48HJzMyajgcnMzNrOh6czMys6fx/6NEkWnHMzmcAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#岭回归模型的coef_\n",
    "coefs = pd.Series(ridge.coef_, index = X_train.columns)\n",
    "\n",
    "ridge_coefs = pd.concat([coefs.sort_values().head(10), coefs.sort_values().tail(10)])\n",
    "ridge_coefs.plot(kind = \"barh\")\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Best alpha : 0.01\n",
      "RMSE on Training set : 743.0656840497085\n",
      "RMSE on Test set : 813.9277131835615\n",
      "r2_score on Training set : 0.8515236713364012\n",
      "r2_score on Test set : 0.8281785275668749\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/wucwu1/anaconda3/lib/python3.7/site-packages/sklearn/linear_model/coordinate_descent.py:491: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Fitting data with very small alpha may cause precision problems.\n",
      "  ConvergenceWarning)\n",
      "/home/wucwu1/anaconda3/lib/python3.7/site-packages/sklearn/linear_model/coordinate_descent.py:491: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Fitting data with very small alpha may cause precision problems.\n",
      "  ConvergenceWarning)\n"
     ]
    }
   ],
   "source": [
    "from sklearn.linear_model import LassoCV\n",
    "\n",
    "\n",
    "#设置超参数搜索范围\n",
    "alphas = [ 0.01, 0.1, 1, 10,100]\n",
    "\n",
    "#生成一个LassoCV实例\n",
    "lasso = LassoCV(alphas=alphas)  \n",
    "\n",
    "lasso.fit(X_train, y_train)\n",
    "alpha = lasso.alpha_\n",
    "print(\"Best alpha :\", alpha)\n",
    "\n",
    "\n",
    "y_train_pred = lasso.predict(X_train)\n",
    "rmse_train = np.sqrt(mean_squared_error(y_train,y_train_pred))\n",
    "print(\"RMSE on Training set :\", rmse_train)\n",
    "\n",
    "y_test_pred = lasso.predict(X_test)\n",
    "rmse_test = np.sqrt(mean_squared_error(y_test,y_test_pred))\n",
    "print(\"RMSE on Test set :\", rmse_test)\n",
    "\n",
    "r2_score_train = r2_score(y_train, y_train_pred)\n",
    "r2_score_test = r2_score(y_test,y_test_pred)\n",
    "print(\"r2_score on Training set :\", r2_score_train)\n",
    "print(\"r2_score on Test set :\", r2_score_test)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAacAAAD8CAYAAADT0WsYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3Xu8X9Od//HXGyFuI22lhhKpYFIVEjmkhvRBpPhhqB9GMa1oy+hl/Dod2owa0p/pr9r0plpSt7plWkNpdahIo5E0jUgiJznRBHH7SWVItJSWFPnMH2sd55uT7/ec7/dcvrfzfj4e5+H73XvtvddKHMtae+33VkRgZmZWTzardQXMzMw6c+dkZmZ1x52TmZnVHXd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tqXGdKhYRc4Dfd9p8AunvATb++zgBuCmSB4EhknYGjiIHJkfEH4CZwNH9X/vyRcSaiHg4f34FWAG8hyZra67vq/nroPwTlP4dK2z/7cAR+Xey1O9xU3DnNDC9h/RqkHar87ZS298FvBQRb3baXu9KtacZ7BQRayD9Rx14d95e6d9tXcpTV2NIo4qma6ukzZXeuPACqfN8gtK/Y2+3J+9/mfQ7Wfft7I0B9ZxTM5L0S+Cvi+z6UkT8rNRhRbYFxf9nJbooX+8atd69UarNDfNnkcOifwJ8LiL+mLOfixYtsq0h2hoRbwGjJQ0B7iRNwW9SLP+zYdvZG+6cGlxETOzBYauB3Qq+7wq0v1yx2PZ1pCmTLfL/uRWWr2ddtbPRPS9p54hYk6eyXsjbS7V5NSkkuXD77CrUsyJKLzL9CTA9Itrf89aUbQWIiJckzSbdcyr1O9beztWStgB2IE3zNvO/357WG6DuAj6SVwG9F9gLeIiUHr9XXjW0Jenm612R7r7+io5Xn5wJlBqV1ZOi7alxnfrKXaS/B9j47+Mu4GN5JdsHgJfzVNgM4EhJ78ir3Y7M2+pGvo9yHbAiIr5VsKup2ippaB4xofRmhomk+2ulfscK238y6Q3hQenf4+ZQ6xUZ/um/H+BE0v9drQeeJ73Ovn3fl0jz3I8C/6tg+zGkVVJPkKYG27fvQfoXfxVwG7BVrdtX5p9B0fY00g/wI2AN8Eb++/wE6Z7DLODx/M935rICvp/b28bGqzQ/nv/+VgFn1bpdRdp5KGlaahnpfXGt+e+vqdoK7Acsye1cDlyctxf9HSO9H++2vP0hYI+CcxX9PW6GHydEmJlZ3fG0npmZ1R13TmZmVnfcOZmZWd1x52RmZnXHnZOZmdUdd05mZlZ33DmZmVndcedkZmZ1538AugA1tTXQDjsAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Lasso模型的coef_\n",
    "coefs = pd.Series(lasso.coef_, index = X_train.columns)\n",
    "\n",
    "lasso_coefs = pd.concat([coefs.sort_values().head(10),\n",
    "                      coefs.sort_values().tail(10)])\n",
    "lasso_coefs.plot(kind = \"barh\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " # 作业思路分析\n",
    "\n",
    "1.导入day.csv\n",
    "2.将类别型变量进行onehot编码\n",
    "3.将数值型变量进行标准化\n",
    "4.拼接形成新的数据集并导出成data.csv\n",
    "5.导入data.csv\n",
    "6.将data.csv按照8：2进行训练集和测试集的分离\n",
    "7.利用三种模型在训练集和测试集上进行RMSE评价和性能测试\n",
    "8.利用三种模型得到各特征的系数\n",
    "\n",
    "性能对比：\n",
    "最小二乘线性回归模型在测试集上的性能为：0.8279474225980321\n",
    "岭回归模型在测试集上的性能为：0.8303582783162683\n",
    "Lasso模型在测试集上的性能为：0.8281785275668749\n",
    "结论：岭回归模型在本案例中的性能最优，最小二乘线性回归模型的性能最差。\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
